namespace BB.Apostas.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class v4 : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.Jornadas", "competicao_Id", "dbo.Competicaos");
            DropIndex("dbo.Jornadas", new[] { "competicao_Id" });
            AddColumn("dbo.Competicaos", "Name", c => c.String());
            AddColumn("dbo.Jogoes", "HomeTeam", c => c.String());
            AddColumn("dbo.Jogoes", "AwayTeam", c => c.String());
            AddColumn("dbo.Jogoes", "HomeScore", c => c.Int(nullable: false));
            AddColumn("dbo.Jogoes", "AwayScore", c => c.Int(nullable: false));
            AddColumn("dbo.Jogoes", "Date", c => c.DateTime(nullable: false));
            AddColumn("dbo.Jogoes", "Fulfilled", c => c.Boolean(nullable: false));
            AddColumn("dbo.Jogoes", "Competicao_Id", c => c.Int());
            AddColumn("dbo.Jogoes", "Jornada_Id", c => c.Int());
            AddColumn("dbo.Jornadas", "Name", c => c.String());
            AddColumn("dbo.Jornadas", "Fulfilled", c => c.Boolean(nullable: false));
            AlterColumn("dbo.Jornadas", "Competicao_Id", c => c.Int());
            AddForeignKey("dbo.Jogoes", "Competicao_Id", "dbo.Competicaos", "Id");
            AddForeignKey("dbo.Jogoes", "Jornada_Id", "dbo.Jornadas", "Id");
            AddForeignKey("dbo.Jornadas", "Competicao_Id", "dbo.Competicaos", "Id");
            CreateIndex("dbo.Jogoes", "Competicao_Id");
            CreateIndex("dbo.Jogoes", "Jornada_Id");
            CreateIndex("dbo.Jornadas", "Competicao_Id");
            DropColumn("dbo.Competicaos", "Descricao");
            DropColumn("dbo.Jornadas", "Descricao");
            DropColumn("dbo.Jornadas", "Realizada");
        }
        
        public override void Down()
        {
            AddColumn("dbo.Jornadas", "Realizada", c => c.Boolean(nullable: false));
            AddColumn("dbo.Jornadas", "Descricao", c => c.String());
            AddColumn("dbo.Competicaos", "Descricao", c => c.String());
            DropIndex("dbo.Jornadas", new[] { "Competicao_Id" });
            DropIndex("dbo.Jogoes", new[] { "Jornada_Id" });
            DropIndex("dbo.Jogoes", new[] { "Competicao_Id" });
            DropForeignKey("dbo.Jornadas", "Competicao_Id", "dbo.Competicaos");
            DropForeignKey("dbo.Jogoes", "Jornada_Id", "dbo.Jornadas");
            DropForeignKey("dbo.Jogoes", "Competicao_Id", "dbo.Competicaos");
            AlterColumn("dbo.Jornadas", "competicao_Id", c => c.Int());
            DropColumn("dbo.Jornadas", "Fulfilled");
            DropColumn("dbo.Jornadas", "Name");
            DropColumn("dbo.Jogoes", "Jornada_Id");
            DropColumn("dbo.Jogoes", "Competicao_Id");
            DropColumn("dbo.Jogoes", "Fulfilled");
            DropColumn("dbo.Jogoes", "Date");
            DropColumn("dbo.Jogoes", "AwayScore");
            DropColumn("dbo.Jogoes", "HomeScore");
            DropColumn("dbo.Jogoes", "AwayTeam");
            DropColumn("dbo.Jogoes", "HomeTeam");
            DropColumn("dbo.Competicaos", "Name");
            CreateIndex("dbo.Jornadas", "competicao_Id");
            AddForeignKey("dbo.Jornadas", "competicao_Id", "dbo.Competicaos", "Id");
        }
    }
}
